add automatic installation helpers#119
Draft
theoephraim wants to merge 1 commit into
Draft
Conversation
Adds a new `@bomb.sh/tab/install` subpath that ships a built-in installer (and matching uninstaller) for shell completions. CLI authors can wire it into an `init` flow, a `complete install` subcommand, or a postinstall hook, instead of asking users to copy-paste a `source <(...)` line into their shellrc. Closes bombshell-dev#117. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP - exploring what is possible, still needs cleanup
Summary
Adds a new
@bomb.sh/tab/installsubpath that ships built-in installer and uninstaller utilities for shell completions. CLI authors can wire it into aninitflow, acomplete installsubcommand, or a postinstall hook — no more asking users to copy-pastesource <(my-cli complete zsh)into their shellrc.Closes #117.
Design
The installer is opt-in, idempotent, and never touches
.zshrc/.bashrcon its own. Files we write start with a# tab-completion managed-by=tab name=… version=…marker so re-runs detect existing managed installs (and uninstall refuses to clobber unmanaged files). PowerShell uses sentinel-wrapped blocks (# >>> tab:my-cli >>>/# <<< tab:my-cli <<<) for idempotent profile editing.The function returns a structured
InstallResultwith one of:installed/already-installed/updated— doneneeds-user-action— we did our part, returns concrete next-step instructions (e.g. addcompinitline, install bash-completion@2)blocked— refused to proceed (CLI not on PATH, unmanaged file conflict)failed— unexpected error~/.config/fish/completions/<name>.fish$fpathdir → Homebrewsite-functions→~/.zsh/completionscompinitis missing or target isn't in$fpath\$XDG_DATA_HOME/bash-completion/completions/<name>\$PROFILE.CurrentUserAllHostsRestrictedPre-flight checks before any shell-specific logic:
\$PSModulePath(Windows) → ppid →/proc/<ppid>/comm(Linux) orps -p(macOS) →\$SHELLfallbacknode_modules/.binsegments from PATH before resolving, so it correctly rejects local node_modules shims while still accepting fnm/nvm/asdf-managed binariesforce: trueThe uninstaller for zsh walks every dir we might have written to (current
\$fpath+ Homebrew +~/.zsh/completions) so it cleans up even if the user's env has changed since install.Notes on what this is not
Other CLIs in this space (kubectl, gh, AWS CLI) print scripts to stdout and never auto-install. Only Bun auto-installs, and it silently fails on errors. This implementation takes a third path: auto-install where the environment supports it without shellrc edits (fish always, brew-zsh, Linux bash), return clear remediation when it doesn't.
Test plan
Files
`src/install/`:
Build config (`tsdown.config.ts`) and `package.json` exports map are updated for the new `./install` subpath.
🤖 Generated with Claude Code